<template>
  <div></div>
</template>
<script>
import {getAmountCheckList} from '@/api/settle'

export default {
  name: 'FastPayHistory',
  props: {
    fuelRecordId: {
      type: String,
      required: true
    },
    visible: {
      type: Boolean,
      default: false
    }
  },
  watch: {
    visible (newVal) {
      if (newVal && this.fuelRecordId) {
        this.getFuelRecordAmountCheckList()
      }
    }
  },
  mounted () {

  },
  methods: {
    getFuelRecordAmountCheckList () {
      getAmountCheckList(this.fuelRecordId).then(res => {
        var text = ''
        for (var i = 0; i < res.data.length; i++) {
          text = (text + '#' + res.data[i].memberName + '#<strong>' + res.data[i].phone + '</strong>#' + res.data[i].time + '#')
          text = text + '<br>'
        }
        this.$alert(text || '无记录', '秒付历史', {
          dangerouslyUseHTMLString: true
        }).then(res => {
          this.$emit('hideHistory')
        }).catch(err => {
          console.log(err)
          this.$emit('hideHistory')
        })
      }).catch(err => {
        console.log(err)
        this.$emit('hideHistory')
      })
    }
  }
}
</script>